<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>从大到小排序</title>
</head>
<body>
    <script>
        var arr=[66,77,99,55,88];
        function sort(arr){
            for(i=1;i<arr.length;i++){
                for(j=0;j<arr.length-1;j++){//控制需要比较的元素
            if(arr[j]>arr[j+1]){
                var temp;
                temp=arr[j];
                arr[j]=arr[j+1]
                arr[j+1]=temp;
            }
            } 
        }return arr;
        }
        sort(arr); 
        document.write(arr);
    </script>
</body>
</html>